﻿#region Usings
using System.Web.UI.WebControls;
using BK.BL;
using BK.Entities;
using BK.WebSite.AppCode;
using Lib.Data.CriteriaRoutine;
using Lib.Data.ORM.Entity;
using Lib.Utils.WebUtils;
#endregion

namespace BK.WebSite.Controls
{
    public partial class PaymentListControl : BkDataListControl<PaymentItemEntity, PaymentList>
    {
        #region Instance Methods
        protected override bool HandleItemCommand(object source, RepeaterCommandEventArgs e)
        {
            return false;
        }
        #endregion

        #region Instance Properties
        public override string Key
        {
            get { return "PaymentList"; }
        }

        public override Criteria RequiredCriteria
        {
            get
            {
                Criteria result = new Criteria("UserId.Value", Clause.Eq, UserProvider.GetCurrentUser().Id.Value);

                if (AccountId.AllKeysHasValue)
                {
                    result.And("AccountId.Value", Clause.Eq, AccountId.Value);
                }

                return result;
            }
        }

        /// <summary>
        ///Возможно на страницу с этим контроллом будет осуществлен из страницы представляющую список счетов.
        /// </summary>
        private IdentifierInt AccountId
        {
            get { return new IdentifierInt(RequestManager.GetNullableInt(Constants.UrlParams.ACCOUNT_ID)); }
        }
        #endregion
    }
}